﻿function setHeaderText() {
    $("#h_title").text("车辆详情");
    var vehicleId = GetQueryStr("vehicleId");
    $("#hidQuertID").val(vehicleId);
    $("#addOrder").attr("href", "/mb_AddOrder.htm?carid=" + vehicleId)
}
(function () {
    setHeaderText();
})()

function toggletags() {
    $(".menu-tags ul li").click(function () {
        $(this).addClass("tagselected").siblings().removeClass("tagselected");
        if ($(this).attr("class").indexOf("buyshouldkonw") != -1) {
            $(".buy-content").show().siblings().hide();
        }
        else if ($(this).attr("class").indexOf("evlution") != -1) {
            $(".evlution-content").show().siblings().hide();
        }
    })
}
toggletags();


function GetVehicleInfo() {
    var vehicleId = $.trim($("#hidQuertID").val());
    if (vehicleId == "" || vehicleId == null) {
        alert("车辆信息有误，请检查");
    }
    else {
        var _jsParam = new jsonRow();
        _jsParam = addNoAreStatistics(_jsParam, "车辆详情", "m0005");
        _jsParam.AddCell("ACTION", "init");
        _jsParam.AddCell("vehicleId", vehicleId);
        ajaxComm(_jsParam);
    }
}
GetVehicleInfo();

function SetVehicleInfo(_data) {
    $("#vehicle-default").attr("src", _data.rows[0].VEHICLE_DEFAULT_PIC + "  840x400img.jpg");
    $(".vehicle-name").text(_data.rows[0].VEHICLE_NAME);
    $(".vehicle-price").text("￥" + _data.rows[0].VEHICLE_PRICE_DAY + "/天");
    $("#linkPhone").text(_data.rows[0].CUSTOMER_BASEINFO_MOBILE);
    $("#callSeller").attr("href", "tel:" + _data.rows[0].CUSTOMER_BASEINFO_MOBILE);
    $("#spaServiceArea").text(_data.rows[0].VEHICLE_SERVICE_AREA);
    $("#vehicle-code").text(_data.rows[0].V_COUNTRY_NAME + "/" + _data.rows[0].V_CITY_NAME + "/" + _data.rows[0].V_DISTINATION_NAME);
    $("#vehicle-introcontent").text(_data.rows[0].VEHICLE_INTRO);
    $(".buy-content").html(_data.rows[0].ORDER_SHOULD_KNOW);
    $("#djackHeaderPic").attr("src", _data.rows[0].CUSTOMER_DEFAULT_PIC + "  60x60img.jpg")
    $("#djackNickName").text(_data.rows[0].CUSTOMER_NICK)
    $("#djackLink").attr("href", "/mp_DjackVehicle.htm?djackId=" + _data.rows[0].CUSTOMER_REGISTER_ID)
    $("#onlineLinkItem").attr("href", "/mb_chatmessage.htm?receiveId=" + _data.rows[0].CUSTOMER_REGISTER_ID + "&receiveName=" + _data.rows[0].CUSTOMER_NICK)
}

$(".evlution").click(function () {
    var vehicleId = $.trim($("#hidQuertID").val());
    var _jsParam = new jsonRow();
    _jsParam.AddCell("ACTION", "GetVehicleEvlution");
    _jsParam.AddCell("vehicleId", vehicleId);
    ajaxComm(_jsParam);
})